//index.js
//获取应用实例
const app = getApp()
const config=require("../../utils/config.js")
Page({
  data: {
    bannerArr: [],
    typeArr:[],
    activityArr:[],
    indicatorDots: false,
    autoplay: true,
    interval: 3000,
    duration:500,
    new_type:"#FB3635",
    hot_type:"",
    commodityArr:[],
    curpage:1
  },
  // 列表点击事件
  new_type(){ 
    this.setData({
        new_type: "#FB3635",
        hot_type:""
    });
  },
  hot_type(){
    this.setData({
        new_type: "",
        hot_type:"#FB3635"
    });
  },
  onLoad: function () {
    const that=this
    // banner图
    wx.request({
      url: config.yuming,
      data:{
        "service":"App.Banner.Index"
      },
      success(res){
        console.log(res)
        
        
        that.setData({
          "bannerArr":res.data.data
        })
      }
    });
    //分类
    wx.request({
      url: config.yuming,
      data:{
        "service":"App.Banner.Category"
      },
      success(res){
        console.log(res)
        
        that.setData({
          "typeArr":res.data.data
        })
      }
    });
    //活动
    wx.request({
      url: config.yuming,
      data:{
        "service":"App.Banner.Action"
      },
      success(res){
        console.log(res)
        
        that.setData({
          "activityArr":res.data.data
        })
      }
    });
    //初始首页列表
    wx.request({
      url: config.yuming,
      data:{
        "service":"App.Goods.Index",
        "curpage":that.data.curpage
      },
      success(res){
        console.log(res)
        that.setData({
          "commodityArr":res.data.data
        })
      }
    });

  }


})
